﻿using Microsoft.AspNetCore.Hosting;
using System;

namespace WebApp
{
    public static class WebAppApplicationLifetimeExtensions
    {
        public static void RegisterOnStarted(this IApplicationLifetime applicationLifetime, Action onStaredCallback)
        {
            applicationLifetime.ApplicationStarted.Register(onStaredCallback);
        }

        public static void RegisterOnStoped(this IApplicationLifetime applicationLifetime, Action onStopedCallback)
        {
            applicationLifetime.ApplicationStarted.Register(onStopedCallback);
        }

        public static void RegisterOnStoping(this IApplicationLifetime applicationLifetime, Action onStaringCallback)
        {
            applicationLifetime.ApplicationStarted.Register(onStaringCallback);
        }
    }
}
